package mi.payment.ui.admin;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import mi.payment.R;
import mi.payment.ui.base.ParentActivity;
import sunmi.sunmiui.title.Title;

/**
 * 交易开关控制
 * Created by lj on 2017/2/13.
 */
public class TransactionSwitchSettingsActivity extends ParentActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_transaction_switch_setting);
        initView();
    }

    /**
     * 初始化控件
     */
    private void initView() {
        Title mTitle;
        TextView traditionalTransactionLeft, qrcodeTransactionLeft;
        View mTraditionalTransaction;
        View QRCodeTransaction;
        mTitle = (Title) findViewById(R.id.transaction_switch_setting_title);
        mTitle.setButtonVisibility(false, true, true, true);
        mTitle.setHeadBgColor(getResources().getColor(R.color.colorBar));
        mTitle.setTitleText(getResources().getString(R.string.transaction_switch_setting));
        mTitle.setMenuClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TransactionSwitchSettingsActivity.this.finish();
            }
        }, null, null, null);

        mTraditionalTransaction = findViewById(R.id.traditional_transaction);
        QRCodeTransaction = findViewById(R.id.qr_code_transaction);
        traditionalTransactionLeft = (TextView) mTraditionalTransaction.findViewById(R.id.item_left_text);
        traditionalTransactionLeft.setText(getResources().getString(R.string.traditional_transaction));
        qrcodeTransactionLeft = (TextView) QRCodeTransaction.findViewById(R.id.item_left_text);
        qrcodeTransactionLeft.setText(getResources().getString(R.string.qr_code_transaction));

        mTraditionalTransaction.setOnClickListener(this);
        QRCodeTransaction.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.traditional_transaction:
                startActivity(new Intent(this, TraditionalTransactionActivity.class));
                break;
            case R.id.qr_code_transaction:
                startActivity(new Intent(this, QRCodeTransactionActivity.class));
                break;
            default:
                break;
        }
    }
}
